cd "~/dropbox/immigration conjoint/Replication Files/Data"
use "ipsos_rep", clear

cd "~/dropbox/immigration conjoint/Replication Files/Output"
set scheme plotplain

// Table D1: Results in table format

reg choice_exp8 exp8_country_1 i0.exp8_country_2 exp8_skill_1 exp8_skill_2 ///
exp8_age_1 exp8_age_2 exp8_gender_1 exp8_gender_2 exp8_number_1 exp8_number_2 ///
exp8_ideology_2 exp8_ideology_1 exp8_relatives_2 exp8_relatives_1 ///
exp8_reasons_1 exp8_reasons_2, vce(cluster respondent_serial) 

outreg2 using conjoint,  tex   label ctitle("Choice") dec(3) ///
keep(exp8_country_1 exp8_skill_1 exp8_age_1 exp8_gender_1 exp8_number_1 exp8_ideology_2 exp8_relatives_2 exp8_reasons_1) ///
nonotes addnote("Standard error clustered at the individual level", "Omitted categories: Peru, Unqualified, Less than 40, Man, Alone, Right", "No Colombian relatives, New opportunities" , *p<.1; **p<.05; ***p<.01) ///
nocons nor2 noobs  addstat(R^2, e(r2), Obs., e(N)) addtext(Adjusted, No)  replace 

reg choice_exp8 exp8_country_1 i0.exp8_country_2 exp8_skill_1 exp8_skill_2 ///
exp8_age_1 exp8_age_2 exp8_gender_1 exp8_gender_2 exp8_number_1 exp8_number_2 ///
exp8_ideology_2 exp8_ideology_1 exp8_relatives_2 exp8_relatives_1 ///
exp8_reasons_1 exp8_reasons_2 i.urban_cat i.nse i.age i.gender i.education i.municipio_enc, vce(cluster respondent_serial)

outreg2 using conjoint,  tex label  ctitle("Choice")  ///
keep(exp8_country_1 exp8_skill_1 exp8_age_1 exp8_gender_1 exp8_number_1 exp8_ideology_2 exp8_relatives_2 exp8_reasons_1) ///
addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs   append 

reg support_exp8 exp8_country_1 i0.exp8_country_2 exp8_skill_1 exp8_skill_2 ///
exp8_age_1 exp8_age_2 exp8_gender_1 exp8_gender_2 exp8_number_1 exp8_number_2 ///
exp8_ideology_2 exp8_ideology_1 exp8_relatives_2 exp8_relatives_1 ///
exp8_reasons_1 exp8_reasons_2, vce(cluster respondent_serial)

outreg2 using conjoint,  tex   label ctitle("Support") dec(3) ///
keep(exp8_country_1 exp8_skill_1 exp8_age_1 exp8_gender_1 exp8_number_1 exp8_ideology_2 exp8_relatives_2 exp8_reasons_1) ///
nonotes addnote("Standard error clustered at the individual level", "Omitted categories: Peru, Unqualified, Less than 40, Man, Alone, Right", "No Colombian relatives, New opportunities" , *p<.1; **p<.05; ***p<.01) ///
nocons nor2 noobs  addstat(R^2, e(r2), Obs., e(N)) addtext(Adjusted, No)  append 

reg support_exp8 exp8_country_1 i0.exp8_country_2 exp8_skill_1 exp8_skill_2 ///
exp8_age_1 exp8_age_2 exp8_gender_1 exp8_gender_2 exp8_number_1 exp8_number_2 ///
exp8_ideology_2 exp8_ideology_1 exp8_relatives_2 exp8_relatives_1 ///
exp8_reasons_1 exp8_reasons_2 i.urban_cat i.nse i.age i.gender i.education i.municipio_enc, vce(cluster respondent_serial)

outreg2 using conjoint,  tex label  ctitle("Support")  ///
keep(exp8_country_1 exp8_skill_1 exp8_age_1 exp8_gender_1 exp8_number_1 exp8_ideology_2 exp8_relatives_2 exp8_reasons_1) ///
addtext(Adjusted, Yes) dec(3) nocons addstat(R^2, e(r2), Obs., e(N))   nor2 noobs   append 
